package CtrlLayer;
import java.util.ArrayList;
import ModelLayer.Manager;
import ModelLayer.ManagerContainer;


/**
 * Write a description of class ManagerController here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ManagerController
{
    private ManagerContainer managerContainer;
    
    public ManagerController()
    {
        managerContainer = ManagerContainer.getInstance();
    }

    public void createManagerObjects()
    {
        managerContainer.addManager(new Manager("Boss", "Sofiendelsvej 58", "Aalborg", "9002", "boss1@gmail.com", 3));
    }
    
    public void createManager(String name, String address, String city, String postCode, String eMail, int managerId)
    {
        managerContainer.addManager(new Manager(name, address, city, postCode, eMail, managerId));
    }
    
    public Manager findManager(int managerId)
    {
        return managerContainer.findManagerById(managerId);
    }
    
    public void deleteManager(int managerId)
    {
        managerContainer.deleteManager(managerContainer.findManagerById(managerId));
    }
    
    public void updateManager(String name, String address, String city, String postCode, String eMail, int managerId)
    {
        Manager c = managerContainer.findManagerById(managerId);
        if(c !=null)
        {
            c.setName(name);
            c.setAddress(address);
            c.setCity(city);
            c.setPostCode(postCode);
            c.setEMail(eMail);
        }
    }
}
